package com.zhima.feignclient;

import com.zhima.dto.FeignSimpleContestInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient("oj-contest-service")
@RequestMapping("/oj-contest/contest/feign")
public interface ContestFeignClient {
    /**
     * 记录用户在本场比赛中本题提交
     *
     * @param contestId
     * @param questionIndex
     * @param userId
     * @return
     */
    @PostMapping("/{contestId}/{questionIndex}/{userId}")
    boolean recordUserSubmit(@PathVariable("contestId") Long contestId, @PathVariable("questionIndex") Integer questionIndex, @PathVariable("userId") Long userId);

    /**
     * 根据{contestId}获取比赛简略信息
     *
     * @param contestId
     * @return
     */
    @GetMapping("/{contestId}")
    FeignSimpleContestInfo getSimpleContestInfo(@PathVariable("contestId") Long contestId);

    @GetMapping("/magnification/{contestId}/{questionIndex}")
    Integer getMagnification(@PathVariable("contestId") Long contestId, @PathVariable("questionIndex") Integer questionIndex);
}
